/*
Abstract:
  Analyzer functionality declaration

Last changed:
  $Id: analyzer.h 82 2009-12-08 20:53:44Z vitamin.caig $

Author:
  (C) Vitamin/CAIG/2001

  This file is the part of Textator project
*/

#ifndef __ANALYZER_H_DEFINED__
#define __ANALYZER_H_DEFINED__

#include <structures.h>

namespace Analyzer
{
  namespace Statistic
  {
    struct Aliasing
    {
      Aliasing() : AliasesCount(), AliasedSymbols()
      {
      }
      std::size_t AliasesCount;
      std::size_t AliasedSymbols;
    };

    struct Tokenizing
    {
      Tokenizing() : TokensCount(), TokensSymbols(), TokensReferences(), TokenizedSymbols(), MaxTokenSize()
      {
      }
      std::size_t TokensCount;
      std::size_t TokensSymbols;
      std::size_t TokensReferences;
      std::size_t TokenizedSymbols;
      std::size_t MaxTokenSize;
    };
  }

  //preprocessing analyzer
  void ByStrings(const StringMap& source, EntriesMap& result, StringMap& remainder, Statistic::Aliasing& statistic);

  struct ByWordsParameters
  {
    std::size_t MinWordSize;
    std::size_t MinWordsReferences;
  };

  void ByWords(const StringMap& source, const ByWordsParameters& params, EntriesMap& result, Statistic::Tokenizing& statistic);

  struct ByFragmentsParameters
  {
    std::size_t MinFragmentSize;
    std::size_t MaxFragmentSize;
    std::size_t MinFragmentReferences;
  };
  void ByFragments(const StringMap& source, const ByFragmentsParameters& params, EntriesMap& result, Statistic::Tokenizing& statistic);
}

#endif
